//
//  LevelLayout.swift
//  CTCollectionViewDemo
//
//  Created by GodCoder on 2019/8/6.
//  Copyright © 2019 CTCollectionView. All rights reserved.
//

import UIKit

class LevelLayout: UICollectionViewFlowLayout {

//    /// 重新设置中心点位置
//    override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
//        var point = super.targetContentOffset(forProposedContentOffset: proposedContentOffset, withScrollingVelocity: velocity)
//        if self.scrollDirection == .horizontal {
//            let page = round(proposedContentOffset.x/(self.itemSize.width + self.minimumLineSpacing))
//            let pageX = self.itemSize.width * (page + 0.5) - (self.collectionView?.bounds.size.width)! * 0.5 + self.minimumLineSpacing*page
//            point.x = pageX
//        }
//        else {
//            let page = round(proposedContentOffset.y/(self.itemSize.height + self.minimumLineSpacing))
//            let pageY = self.itemSize.height * (page + 0.5) - (self.collectionView?.bounds.size.height)! * 0.5 + self.minimumLineSpacing*page
//            point.y = pageY
//        }
//
//        return point
//    }
//
//    override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
//        return true
//    }
}
